package model;

/**
 * this class represents a user
 */
public class User {

    /**
     * constant User reference, is used as the winner of archived matches without a winner
     */
    public static final User NO_USER = new User( "keiner" );

    /**
     * user id
     */
    private int id;
    /**
     * nickname of user
     */
    private String nick;
    /**
     * first name of user
     */
    private String firstName;
    /**
     * last name of user
     */
    private String lastName;
    /**
     * time from last client login
     */
    private String lastLogin;

    /**
     * constructor to create the login user with the login data
     * 
     * @param loginData
     *            contains information about user name, user id and last login
     */
    public User( String[] loginData )
    {
	this.id = Integer.valueOf( loginData[1] );
	this.lastLogin = loginData[2];
	this.nick = loginData[3];
	this.firstName = loginData[4];
	this.lastName = loginData[5];
    }

    /**
     * constructor to create an user just with only the nick, intended for a opponent user
     * 
     * @param newNick
     *            nick of the user
     */
    public User( String newNick )
    {
	this.nick = newNick;
    }

    public final int getId()
    {
	return this.id;
    }

    public final String getNick()
    {
	return this.nick;
    }

    public final String getFirstName()
    {
	return this.firstName;
    }

    public final String getLastName()
    {
	return this.lastName;
    }

    public final String getLastLogin()
    {
	return this.lastLogin;
    }

}
